package cn.hfuu.service.impl;

import cn.hfuu.dao.LinkManDao;
import cn.hfuu.domain.Customer;
import cn.hfuu.domain.LinkMan;
import cn.hfuu.service.LinkManService;
import cn.hfuu.utils.PageBean;
import org.hibernate.criterion.DetachedCriteria;

import java.util.List;

public class LinkManServiceImpl implements LinkManService {

    private LinkManDao linkManDao;

    public void save(LinkMan linkMan) {
        linkManDao.saveOrUpdate(linkMan);
    }


    public PageBean getPageBean(DetachedCriteria dc, Integer currentPage, Integer pageSize) {
        //调用dao层方法查询总记录数
        Integer totalCount = linkManDao.getTotalCount(dc);
        //查询当前页面显示列表

        PageBean pb = new PageBean(totalCount,currentPage,pageSize);

        List<LinkMan> list = linkManDao.getPageList(dc,pb.getStart(),pb.getPageSize());
        pb.setList(list);

        return pb;
    }

    @Override
    public LinkMan getById(Long lkm_id) {
        return linkManDao.getById(lkm_id);
    }

    public LinkManDao getLinkManDao() {
        return linkManDao;
    }

    public void setLinkManDao(LinkManDao linkManDao) {
        this.linkManDao = linkManDao;
    }
}
